<template>
  <div class="der">
    <section class="top">
      <div class="top-a" @click="fun($event)">
        <div v-if="!showname"><span>登录</span> / <span>开通</span></div>
        <span>{{ str }}</span>
        <p>登陆后享受更多金融服务</p>
      </div>
      <div>
        <img src="@/assets/ayuan/images/c1_03.gif" alt="" /><span class="min"
          >&gt;</span
        >
      </div>
    </section>
    <div class="gif">
      <img src="@/assets/ayuan/images/c1_07.gif" alt="" />
    </div>
  </div>
</template>

<!-- <script>
import { cha_kan } from "@/apis/mycom.js";
export default {
  data() {
    return {
      str: "",
      name:"张三",
      password:"123",
      showname: true,
    };
  },
  methods: {
    
  },
  created(){
    cha_kan({
      name:this.name,
      password:this.password
    }).then((res)=>{
      console.log(res.data);
      if(localStorage.token){
        this.showname=true;
        this.str=this.name
      }else{
        this.showname=false;
      this.$router.push("/login");
      }
    })
  }
};
</script> -->
<script>
// import { cha_kan } from "@/apis/mycom.js";
export default {
  data() {
    return {
      str: "",
      name: "",
      showname: "",
    };
  },
  methods: {
    fun(){
      if(localStorage.token){
      this.$router.push('/')
    }else{
      this.$router.push('/login')
    }
    }
  },
  created(){
    if(localStorage.token){
      this.showname=true;
      this.str=localStorage.token
    }else{
      // console.log(2);
    }

  }
};
</script>

<style lang="scss" scoped>
.top {
  height: 0.56rem;
  width: 100%;
  display: flex;
  justify-content: space-around;
  span {
    font-size: 0.24rem;
    font-weight: 700;
  }
  p {
    font-size: 0.14rem;
    color: gray;
  }
  .min {
    // margin-top: -.2rem;
    display: block;
    font-size: 0.45rem;
    position: absolute;
    top: -0.03rem;
    right: 0.08rem;
    color: gray;
  }
}
.gif {
  margin-top: 0.28rem;
  margin-left: 0.16rem;
}
</style>